<?php

class Login_Model extends Model
{
	public function __construct()
	{
		parent::Model();
		
		// open the database
		$this->load->database();
	}
	
	function login_check($username, $password)
	{
		$id=-1;

		$result = $this->db->query('SELECT user_id
							FROM admin_login 
							WHERE username = \''.$username.'\' AND password = \''.$password.'\'');
		
		if($result->num_rows()==1)
		{	foreach($result->result() as $row)
			{
				$id=$row->user_id;
			}
		}
		return $id;
	}
}
?>